<?php namespace Admin\Model;
use Hdphp\Model\Model;
class Cate extends Model{
	protected $table = "category";
	public function cateData(){
		//获取顶级分类
        $cate = $this->where("pid=0")->get();
            //把二级分类插入一级分类下
        foreach($cate as $k => &$v){
            $son = $this->where("pid={$v['cid']}")->get();
            $v['son'] = $son;
        }
        return $cate;
	}






}
?>